package app.android.demo.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import app.android.demo.R;

public class ActivityC extends Activity {
	
	final static String  TAG =  "ActivityC";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(TAG, "onCreate");
        Log.d(TAG, this.toString() + "");
        Log.d(TAG, "getTaskId:" + this.getTaskId() + "");
        TextView textView = new TextView(this);
        textView.setTextSize(28);
        textView.setText(this.toString() + ""); 
        TextView textView1 = new TextView(this);
        textView1.setTextSize(28);
        textView1.setText("getTaskId:" + this.getTaskId() + "");
        Button button = new Button(this);
        button.setText("Im C , go actD"); 
        button.setOnClickListener(new OnClickListener() { 
            @Override 
            public void onClick(View v) { 
                Intent intent = new Intent();
//                intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP |Intent.FLAG_ACTIVITY_CLEAR_TOP);
                intent.setClass(ActivityC.this, ActivityD.class); 
                startActivity(intent); 
            } 
        }); 
        LinearLayout layout = new LinearLayout(this); 
        layout.setOrientation(LinearLayout.VERTICAL); 
        layout.addView(textView); 
        layout.addView(textView1); 
        layout.addView(button); 
        this.setContentView(layout);
        // The activity is being created.
    }
    
    @Override
    protected void onSaveInstanceState(Bundle outState) {
    	// TODO Auto-generated method stub
    	super.onSaveInstanceState(outState);
    	Log.d(TAG, "onSaveInstanceState");
    }
    
    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
    	// TODO Auto-generated method stub
    	super.onRestoreInstanceState(savedInstanceState);
    	Log.d(TAG, "onRestoreInstanceState");
    }
    
    @Override
    protected void onStart() {
        super.onStart();
        Log.d(TAG, "onStart");
        // The activity is about to become visible.
    }
    @Override
    protected void onRestart() {
    	// TODO Auto-generated method stub
    	super.onRestart();
    	Log.d(TAG, "onRestart");
    }
    
    @Override
    protected void onResume() {
        super.onResume();
        Log.d(TAG, "onResume");
        // The activity has become visible (it is now "resumed").
    }
    @Override
    protected void onPause() {
        super.onPause();
        Log.d(TAG, "onPause");
        // Another activity is taking focus (this activity is about to be "paused").
    }
    @Override
    protected void onStop() {
        super.onStop();
        Log.d(TAG, "onStop");
        // The activity is no longer visible (it is now "stopped")
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "onDestroy");
        // The activity is about to be destroyed.
    }
    @Override
    protected void onNewIntent(Intent intent) {
    // TODO Auto-generated method stub
	    super.onNewIntent(intent);
	    Log.d(TAG, "onNewIntent");
    }
}
